#!/bin/sh
dir="/data/src/java/LogSyncerClient/deploy/run.sh"
logfile="/data/src/java/LogSyncerClient/deploy/monitor.log"
proc=$(ps -ef |grep  "LogSyncerClient.jar" |grep -v "grep"|wc -l)

if [ $proc -gt 0 ]; then
        echo $(date +%Y"-"%m"-"%d" "%H":"%M":"%S)":client is started..." >> $logfile
else
        echo $(date +%Y"-"%m"-"%d" "%H":"%M":"%S)":client is shutdown..." >> $logfile
        sh $dir & >> $logfile
        echo $(date +%Y"-"%m"-"%d" "%H":"%M":"%S)":client is restarted..." >> $logfile
fi
